/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import DAO.*;
import DTO.*;
import DAO.garantiasDAO;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.swing.JRViewer;

/**
 *
 * @author Luis Olave 10
 */
public class AlzamientoGarantia extends javax.swing.JFrame {

    usuarioDTO user;
    garantiasDAO reg = new garantiasDAO();
    garantiaAutomotrizDTO auto = new garantiaAutomotrizDTO();
    garantiaWarrantsDTO warra = new garantiaWarrantsDTO();
    garantiaCdpOtrosDTO cdp = new garantiaCdpOtrosDTO();
    garantiaHipotecariaDTO casa = new garantiaHipotecariaDTO();
    
    /**
     * Creates new form AlzamientoGarantia
     */
    public AlzamientoGarantia(usuarioDTO user) {
        this.user = user;
        initComponents();
        pnlAutomotriz.setVisible(false);
        pnlCDP.setVisible(false);
        pnlHipotecaria.setVisible(false);
        pnlWarrant.setVisible(false);
        lblMensaje.setVisible(false);
        this.rbtRolSii.setSelected(true);
        this.btnGrabarAlzamiento.setVisible(false);
        this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        lblLogo = new javax.swing.JLabel();
        lblIngresoGaraAuto = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel10 = new javax.swing.JPanel();
        pnlAutomotriz = new javax.swing.JPanel();
        txtPatenteAlzamiento = new javax.swing.JTextField();
        chkAutomotrizAlzamiento = new javax.swing.JCheckBox();
        chkWarrantAlzamiento = new javax.swing.JCheckBox();
        pnlWarrant = new javax.swing.JPanel();
        txtDUNAlzamiento = new javax.swing.JTextField();
        pnlCDP = new javax.swing.JPanel();
        txtNumeroAlzamiento = new javax.swing.JTextField();
        chkCDPAlzamiento = new javax.swing.JCheckBox();
        pnlDatosPersoGara1 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jLabel36 = new javax.swing.JLabel();
        jLabel37 = new javax.swing.JLabel();
        jLabel39 = new javax.swing.JLabel();
        jLabel40 = new javax.swing.JLabel();
        txtNombreGaranteAlzamiento = new javax.swing.JTextField();
        txtApellMaternoAlzamiento = new javax.swing.JTextField();
        txtApellPatGaranteAlzamiento = new javax.swing.JTextField();
        txtRutGaraAlzamiento = new javax.swing.JTextField();
        btnMenuPrincipalAlzamiento = new javax.swing.JButton();
        chkHipotecariaAlzamiento = new javax.swing.JCheckBox();
        pnlHipotecaria = new javax.swing.JPanel();
        txtHipoAlzamiento = new javax.swing.JTextField();
        btnBuscar = new javax.swing.JButton();
        jPanel12 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        pnlDescripGarantia = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        txtOtroComentarioAlzamiento = new javax.swing.JTextArea();
        jScrollPane4 = new javax.swing.JScrollPane();
        txtDescripcionAlzamiento = new javax.swing.JTextArea();
        lblDescripcion = new javax.swing.JLabel();
        jPanel13 = new javax.swing.JPanel();
        btnGrabarAlzamiento = new javax.swing.JButton();
        jPanel9 = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        txtMotivoAlzamiento = new javax.swing.JTextField();
        cmbMonedaAlzamiento = new javax.swing.JComboBox();
        cmbSucursalAlzamiento = new javax.swing.JComboBox();
        jcUltimaTasacion = new com.toedter.calendar.JDateChooser();
        jcFechaExtincion = new com.toedter.calendar.JDateChooser();
        txtTipoGarantia = new javax.swing.JTextField();
        lblMensaje = new javax.swing.JLabel();
        lblMotivoDeAlza = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tbSalidaIDImprimir = new javax.swing.JTable();
        jPanel4 = new javax.swing.JPanel();
        rbtRolSii = new javax.swing.JRadioButton();
        rbtPatente = new javax.swing.JRadioButton();
        rbtDun = new javax.swing.JRadioButton();
        rbtNumeroCDP = new javax.swing.JRadioButton();
        jPanel5 = new javax.swing.JPanel();
        btnBuscarIDGarantia = new javax.swing.JButton();
        txtBuscarIDGarantia = new javax.swing.JTextField();
        btnImprimirGarantia = new javax.swing.JButton();
        btnMenuPrincipal = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("ALZAMIENTO GARANTÍA");
        setResizable(false);

        lblLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/IMAGE/logo.JPG"))); // NOI18N

        lblIngresoGaraAuto.setFont(new java.awt.Font("Century Gothic", 1, 18)); // NOI18N
        lblIngresoGaraAuto.setText("ALZAMIENTO GARANTÍA");

        jTabbedPane1.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N

        pnlAutomotriz.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "INGRESE PATENTE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        javax.swing.GroupLayout pnlAutomotrizLayout = new javax.swing.GroupLayout(pnlAutomotriz);
        pnlAutomotriz.setLayout(pnlAutomotrizLayout);
        pnlAutomotrizLayout.setHorizontalGroup(
            pnlAutomotrizLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlAutomotrizLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txtPatenteAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pnlAutomotrizLayout.setVerticalGroup(
            pnlAutomotrizLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlAutomotrizLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txtPatenteAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        buttonGroup1.add(chkAutomotrizAlzamiento);
        chkAutomotrizAlzamiento.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        chkAutomotrizAlzamiento.setText("AUTOMOTRIZ");
        chkAutomotrizAlzamiento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkAutomotrizAlzamientoActionPerformed(evt);
            }
        });

        buttonGroup1.add(chkWarrantAlzamiento);
        chkWarrantAlzamiento.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        chkWarrantAlzamiento.setText("WARRANT");
        chkWarrantAlzamiento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkWarrantAlzamientoActionPerformed(evt);
            }
        });

        pnlWarrant.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "INGRESE CÓDIGO ÚNICO (D.U.N 14)", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        javax.swing.GroupLayout pnlWarrantLayout = new javax.swing.GroupLayout(pnlWarrant);
        pnlWarrant.setLayout(pnlWarrantLayout);
        pnlWarrantLayout.setHorizontalGroup(
            pnlWarrantLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlWarrantLayout.createSequentialGroup()
                .addGap(36, 36, 36)
                .addComponent(txtDUNAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(41, Short.MAX_VALUE))
        );
        pnlWarrantLayout.setVerticalGroup(
            pnlWarrantLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlWarrantLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(txtDUNAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(31, 31, 31))
        );

        pnlCDP.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "INGRESE NÚMERO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        javax.swing.GroupLayout pnlCDPLayout = new javax.swing.GroupLayout(pnlCDP);
        pnlCDP.setLayout(pnlCDPLayout);
        pnlCDPLayout.setHorizontalGroup(
            pnlCDPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlCDPLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txtNumeroAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pnlCDPLayout.setVerticalGroup(
            pnlCDPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlCDPLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txtNumeroAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        buttonGroup1.add(chkCDPAlzamiento);
        chkCDPAlzamiento.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        chkCDPAlzamiento.setText("CDP");
        chkCDPAlzamiento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkCDPAlzamientoActionPerformed(evt);
            }
        });

        pnlDatosPersoGara1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DATOS PERSONALES GARANTE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        jLabel36.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel36.setText("RUT");

        jLabel37.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel37.setText("APELLIDO PATERNO");

        jLabel39.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel39.setText("APELLIDO MATERNO");

        jLabel40.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel40.setText("NOMBRE");

        txtNombreGaranteAlzamiento.setBackground(new java.awt.Color(255, 255, 102));
        txtNombreGaranteAlzamiento.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtNombreGaranteAlzamiento.setEnabled(false);

        txtApellMaternoAlzamiento.setBackground(new java.awt.Color(255, 255, 102));
        txtApellMaternoAlzamiento.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtApellMaternoAlzamiento.setEnabled(false);

        txtApellPatGaranteAlzamiento.setBackground(new java.awt.Color(255, 255, 102));
        txtApellPatGaranteAlzamiento.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtApellPatGaranteAlzamiento.setEnabled(false);

        txtRutGaraAlzamiento.setBackground(new java.awt.Color(255, 255, 102));
        txtRutGaraAlzamiento.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtRutGaraAlzamiento.setEnabled(false);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel37)
                    .addComponent(jLabel36))
                .addGap(18, 18, 18)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtRutGaraAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtApellPatGaranteAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 105, Short.MAX_VALUE)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel39)
                    .addComponent(jLabel40))
                .addGap(18, 18, 18)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtNombreGaranteAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtApellMaternoAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(196, 196, 196))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel36)
                    .addComponent(txtRutGaraAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel40)
                    .addComponent(txtNombreGaranteAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel37)
                    .addComponent(txtApellPatGaranteAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel39)
                    .addComponent(txtApellMaternoAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        javax.swing.GroupLayout pnlDatosPersoGara1Layout = new javax.swing.GroupLayout(pnlDatosPersoGara1);
        pnlDatosPersoGara1.setLayout(pnlDatosPersoGara1Layout);
        pnlDatosPersoGara1Layout.setHorizontalGroup(
            pnlDatosPersoGara1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatosPersoGara1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        pnlDatosPersoGara1Layout.setVerticalGroup(
            pnlDatosPersoGara1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlDatosPersoGara1Layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        btnMenuPrincipalAlzamiento.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnMenuPrincipalAlzamiento.setText("MENÚ PRINCIPAL");
        btnMenuPrincipalAlzamiento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMenuPrincipalAlzamientoActionPerformed(evt);
            }
        });

        buttonGroup1.add(chkHipotecariaAlzamiento);
        chkHipotecariaAlzamiento.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        chkHipotecariaAlzamiento.setText("HIPOTECARIA");
        chkHipotecariaAlzamiento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkHipotecariaAlzamientoActionPerformed(evt);
            }
        });

        pnlHipotecaria.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "INGRESE ROL SII", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        javax.swing.GroupLayout pnlHipotecariaLayout = new javax.swing.GroupLayout(pnlHipotecaria);
        pnlHipotecaria.setLayout(pnlHipotecariaLayout);
        pnlHipotecariaLayout.setHorizontalGroup(
            pnlHipotecariaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlHipotecariaLayout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(txtHipoAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(25, Short.MAX_VALUE))
        );
        pnlHipotecariaLayout.setVerticalGroup(
            pnlHipotecariaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlHipotecariaLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(txtHipoAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(31, 31, 31))
        );

        btnBuscar.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnBuscar.setText("BUSCAR");
        btnBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(340, 340, 340))
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlDatosPersoGara1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel10Layout.createSequentialGroup()
                        .addGap(27, 27, 27)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(pnlAutomotriz, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(chkAutomotrizAlzamiento))
                        .addGap(27, 27, 27)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(pnlWarrant, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(chkWarrantAlzamiento))
                        .addGap(41, 41, 41)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(pnlCDP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(chkCDPAlzamiento))
                        .addGap(41, 41, 41)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(pnlHipotecaria, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(chkHipotecariaAlzamiento)))
                    .addGroup(jPanel10Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(btnMenuPrincipalAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(chkWarrantAlzamiento)
                    .addComponent(chkAutomotrizAlzamiento)
                    .addComponent(chkCDPAlzamiento)
                    .addComponent(chkHipotecariaAlzamiento))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnlCDP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pnlWarrant, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pnlAutomotriz, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pnlHipotecaria, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28)
                .addComponent(btnBuscar)
                .addGap(18, 18, 18)
                .addComponent(pnlDatosPersoGara1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(104, 104, 104)
                .addComponent(btnMenuPrincipalAlzamiento)
                .addGap(65, 65, 65))
        );

        jTabbedPane1.addTab("INFO. GARANTE", jPanel10);

        pnlDescripGarantia.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DESCRIPCIÓN GARANTIA", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        txtOtroComentarioAlzamiento.setColumns(20);
        txtOtroComentarioAlzamiento.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        txtOtroComentarioAlzamiento.setRows(5);
        txtOtroComentarioAlzamiento.setToolTipText("");
        txtOtroComentarioAlzamiento.setEnabled(false);
        jScrollPane3.setViewportView(txtOtroComentarioAlzamiento);

        txtDescripcionAlzamiento.setBackground(new java.awt.Color(255, 255, 102));
        txtDescripcionAlzamiento.setColumns(20);
        txtDescripcionAlzamiento.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        txtDescripcionAlzamiento.setRows(5);
        txtDescripcionAlzamiento.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtDescripcionAlzamiento.setEnabled(false);
        jScrollPane4.setViewportView(txtDescripcionAlzamiento);

        lblDescripcion.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblDescripcion.setText("DESCRIPCIÓN");

        javax.swing.GroupLayout pnlDescripGarantiaLayout = new javax.swing.GroupLayout(pnlDescripGarantia);
        pnlDescripGarantia.setLayout(pnlDescripGarantiaLayout);
        pnlDescripGarantiaLayout.setHorizontalGroup(
            pnlDescripGarantiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDescripGarantiaLayout.createSequentialGroup()
                .addGap(70, 70, 70)
                .addComponent(lblDescripcion)
                .addGap(18, 18, 18)
                .addGroup(pnlDescripGarantiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 582, Short.MAX_VALUE)
                    .addComponent(jScrollPane3))
                .addContainerGap())
        );
        pnlDescripGarantiaLayout.setVerticalGroup(
            pnlDescripGarantiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlDescripGarantiaLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlDescripGarantiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblDescripcion)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(31, 31, 31)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(250, 250, 250))
        );

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlDescripGarantia, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlDescripGarantia, javax.swing.GroupLayout.PREFERRED_SIZE, 359, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(97, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 827, Short.MAX_VALUE)
            .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel12Layout.createSequentialGroup()
                    .addGap(0, 18, Short.MAX_VALUE)
                    .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 18, Short.MAX_VALUE)))
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 495, Short.MAX_VALUE)
            .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel12Layout.createSequentialGroup()
                    .addGap(0, 14, Short.MAX_VALUE)
                    .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 14, Short.MAX_VALUE)))
        );

        jTabbedPane1.addTab("DESCRIP. GARANTÍA", jPanel12);

        btnGrabarAlzamiento.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnGrabarAlzamiento.setText("GRABAR");
        btnGrabarAlzamiento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGrabarAlzamientoActionPerformed(evt);
            }
        });

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "ALZAMIENTO GARANTÍA", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        jLabel2.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel2.setText("SUCURSAL");

        jLabel3.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel3.setText("TIPO GARANTÍA");

        jLabel4.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel4.setText("MONEDA");

        jLabel5.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel5.setText("FECHA EXTINCIÓN");

        jLabel6.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel6.setText("FECHA ÚLT. TASACIÓN");

        jLabel7.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel7.setText("MOTIVO ALZAMIENTO");

        cmbMonedaAlzamiento.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
        cmbMonedaAlzamiento.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione" }));

        cmbSucursalAlzamiento.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
        cmbSucursalAlzamiento.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione" }));

        txtTipoGarantia.setBackground(new java.awt.Color(255, 255, 102));
        txtTipoGarantia.setDisabledTextColor(new java.awt.Color(0, 0, 204));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6)
                    .addComponent(jLabel3)
                    .addComponent(jLabel2))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(cmbSucursalAlzamiento, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcUltimaTasacion, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE)
                    .addComponent(txtTipoGarantia))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addComponent(jLabel5)
                    .addComponent(jLabel4))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jcFechaExtincion, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE)
                    .addComponent(cmbMonedaAlzamiento, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtMotivoAlzamiento))
                .addContainerGap(48, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel5))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(cmbSucursalAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(txtTipoGarantia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(cmbMonedaAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jcFechaExtincion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel6)
                        .addComponent(jLabel7)
                        .addComponent(txtMotivoAlzamiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jcUltimaTasacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        lblMensaje.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        lblMensaje.setForeground(new java.awt.Color(255, 0, 0));
        lblMensaje.setText("ESTA GARANTIA FUE ALZADA.");

        lblMotivoDeAlza.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addGap(139, 139, 139)
                        .addComponent(lblMotivoDeAlza))
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addGap(228, 228, 228)
                        .addComponent(lblMensaje))
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(149, Short.MAX_VALUE))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(44, 44, 44)
                .addComponent(lblMensaje)
                .addGap(18, 18, 18)
                .addComponent(lblMotivoDeAlza)
                .addGap(0, 199, Short.MAX_VALUE))
        );

        jButton1.setText("MENÚ PRINCIPAL");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel13Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel13Layout.createSequentialGroup()
                        .addGap(368, 368, 368)
                        .addComponent(btnGrabarAlzamiento)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel13Layout.setVerticalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnGrabarAlzamiento)
                    .addComponent(jButton1))
                .addContainerGap(48, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("ALZAMIENTO GARANTÍA", jPanel13);

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "ÁREA IMPRESIÓN", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        tbSalidaIDImprimir.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        jScrollPane1.setViewportView(tbSalidaIDImprimir);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "IDENTIFICACIÓN DE GARANTÍAS", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        buttonGroup2.add(rbtRolSii);
        rbtRolSii.setText("ROL SII");

        buttonGroup2.add(rbtPatente);
        rbtPatente.setText("PATENTE");

        buttonGroup2.add(rbtDun);
        rbtDun.setText("D.U.N. 14");

        buttonGroup2.add(rbtNumeroCDP);
        rbtNumeroCDP.setText("NÚMERO CDP");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(rbtRolSii)
                .addGap(18, 18, 18)
                .addComponent(rbtPatente)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 37, Short.MAX_VALUE)
                .addComponent(rbtDun)
                .addGap(18, 18, 18)
                .addComponent(rbtNumeroCDP)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(16, 16, 16)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(rbtRolSii)
                    .addComponent(rbtPatente)
                    .addComponent(rbtDun)
                    .addComponent(rbtNumeroCDP))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "INGRESE ID DE LA GARANTÍA", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        btnBuscarIDGarantia.setText("BUSCAR");
        btnBuscarIDGarantia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarIDGarantiaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btnBuscarIDGarantia, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtBuscarIDGarantia, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(30, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(txtBuscarIDGarantia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnBuscarIDGarantia)
                .addContainerGap())
        );

        btnImprimirGarantia.setText("IMPRIMIR");
        btnImprimirGarantia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnImprimirGarantiaActionPerformed(evt);
            }
        });

        btnMenuPrincipal.setText("MENÚ PRINCIPAL");
        btnMenuPrincipal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMenuPrincipalActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnImprimirGarantia, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(186, 186, 186)
                        .addComponent(btnMenuPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(29, 29, 29))))
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(314, 314, 314)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(216, 216, 216)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 218, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(4, 4, 4)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnImprimirGarantia)
                    .addComponent(btnMenuPrincipal))
                .addGap(235, 235, 235))
        );

        jTabbedPane1.addTab("IMPRIMIR", jPanel2);

        jLabel1.setText("MENÚ PRINCIPAL\\ALZAMIENTO GARANTÍA");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblLogo)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(114, 114, 114)
                        .addComponent(lblIngresoGaraAuto))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel1)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addComponent(jTabbedPane1)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblLogo)
                    .addComponent(lblIngresoGaraAuto)
                    .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 525, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(223, 223, 223))
        );

        setSize(new java.awt.Dimension(848, 656));
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void btnMenuPrincipalAlzamientoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMenuPrincipalAlzamientoActionPerformed
        MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
        venMenuPrincipal.setVisible(true);
        AlzamientoGarantia.this.dispose();
    }//GEN-LAST:event_btnMenuPrincipalAlzamientoActionPerformed

    private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
        //CARGAR GARANTIA AUTOMOTRIZ
        try
        {
        if (chkAutomotrizAlzamiento.isSelected()) 
        {
            if (txtPatenteAlzamiento.getText().equals("")) 
            {
                javax.swing.JOptionPane.showMessageDialog(null, "Ingrese Patente");
                this.txtPatenteAlzamiento.setText("");
                this.txtDUNAlzamiento.setText("");
                this.txtNumeroAlzamiento.setText("");
                this.txtHipoAlzamiento.setText("");
                limpiar();
                this.btnGrabarAlzamiento.setVisible(false);
            }
            else
            {
                auto = reg.buscarPorPatente(txtPatenteAlzamiento.getText());
                int apoyo = auto.getFolio_garantia_auto();
                if (auto.getFolio_garantia_auto() == 0) 
                {
                    javax.swing.JOptionPane.showMessageDialog(null, "Garantia NO ENCONTRADA");
                    this.txtPatenteAlzamiento.setText("");
                    this.txtDUNAlzamiento.setText("");
                    this.txtNumeroAlzamiento.setText("");
                    this.txtHipoAlzamiento.setText("");
                    limpiar();
                    this.btnGrabarAlzamiento.setVisible(false);
                }
                else
                {
                    String auxiliar = LOGIN.Seguridad.ComprobarAprobacionGarantia("Aprobada", "garantia_automotriz", "estado_auto", "folio_garantia_auto", apoyo);
                    if (auxiliar.equalsIgnoreCase("Aprobada"))
                    {
                        this.btnGrabarAlzamiento.setVisible(true);
                        txtRutGaraAlzamiento.setText(auto.getRut_gara_auto());
                        txtApellPatGaranteAlzamiento.setText(auto.getApell_paterno_auto());
                        txtApellMaternoAlzamiento.setText(auto.getApell_materno_auto());
                        txtNombreGaranteAlzamiento.setText(auto.getNombre_auto());
//                        txtFolioGaranteAlzamiento.setText(String.valueOf(auto.getFolio_garantia_auto()));
                        txtDescripcionAlzamiento.setText(auto.getDescrip_auto());
                        txtOtroComentarioAlzamiento.setText(auto.getComent_auto());
                        this.txtDUNAlzamiento.setText("");
                        this.txtNumeroAlzamiento.setText("");
                        this.txtHipoAlzamiento.setText("");
                        
                        List<sucursalDTO> listaSucursal = garantiasDAO.listaItemSucursal();
                        for(int i= 0;i< listaSucursal.size();i++){
                        this.cmbSucursalAlzamiento.addItem(listaSucursal.get(i).getNom_sucursal());
                        }
                        this.cmbSucursalAlzamiento.setSelectedItem(auto.getSucursal_auto());
                        
                        txtTipoGarantia.setText("Automotriz");
                        Date aux = DTO.ConversionFechas.convertToDate(auto.getFecha_ult_tasa_auto());
                        jcUltimaTasacion.setDate(aux);
                        
                         List<monedaDTO> moneda = garantiasDAO.listaItemMoneda();
                        for(int i= 0;i< moneda.size();i++){
                        this.cmbMonedaAlzamiento.addItem(moneda.get(i).getNom_moneda());
                        }
                        this.cmbMonedaAlzamiento.setSelectedItem(auto.getMoneda_auto());
                      
                        
                        
                        jcFechaExtincion.setDate(new Date(auto.getFech_extincion_auto().getTime()));



                         if(auto.getMotivo_alza() == null)
                        {
                            lblMensaje.setVisible(false);
                            jLabel7.setVisible(true);
                            txtMotivoAlzamiento.setVisible(true);
                            lblMotivoDeAlza.setVisible(false);
                            btnGrabarAlzamiento.setVisible(true);
                            javax.swing.JOptionPane.showMessageDialog(null, "Hay una solicitud de alzamiento pendiente");
                        }
                        
                        else if (auto.getEstado_alza() != null ) {
                            lblMensaje.setVisible(true);
                            jLabel7.setVisible(false);
                            txtMotivoAlzamiento.setVisible(false);
                            lblMotivoDeAlza.setVisible(true);
                            lblMotivoDeAlza.setText("MOTIVO: " + auto.getMotivo_alza().toUpperCase() + ".");
                            btnGrabarAlzamiento.setVisible(false);
                            javax.swing.JOptionPane.showMessageDialog(null, "solicitud de aprobacion alzamiento hecho");
//                            
                        }
                        else
                        {
                            lblMensaje.setVisible(true);
                            jLabel7.setVisible(false);
                            txtMotivoAlzamiento.setVisible(false);
                            lblMotivoDeAlza.setVisible(true);
                            lblMotivoDeAlza.setText("MOTIVO: " + auto.getMotivo_alza().toUpperCase() + ".");
                            btnGrabarAlzamiento.setVisible(false);
                            javax.swing.JOptionPane.showMessageDialog(null, "Pasar a solicitud en estado de aprobacion alzamiento");
                        }
                        
                    }
                    else
                    {
                        javax.swing.JOptionPane.showMessageDialog(null, "Esta garantia no se ha aprobado o estado activa. \n Revisa el estado de APROBACION");
                        this.txtPatenteAlzamiento.setText("");
                        this.txtDUNAlzamiento.setText("");
                        this.txtNumeroAlzamiento.setText("");
                        this.txtHipoAlzamiento.setText("");
                        limpiar();
                        this.btnGrabarAlzamiento.setVisible(false);
                    }
                }
            }
        }
        }catch(Exception e)
        {
            e.getMessage();
        }
        
        //CARGAR GARANTIA WARRANT
        try
        {
        if (chkWarrantAlzamiento.isSelected()) 
        {
            if (txtDUNAlzamiento.getText().equals("")) 
            {
                javax.swing.JOptionPane.showMessageDialog(null, "Ingrese DUN");
                this.txtPatenteAlzamiento.setText("");
                this.txtDUNAlzamiento.setText("");
                this.txtNumeroAlzamiento.setText("");
                this.txtHipoAlzamiento.setText("");
                limpiar();
                this.btnGrabarAlzamiento.setVisible(false);
            }
            else
            {
                warra = reg.buscarPorDUN(txtDUNAlzamiento.getText());
                int apoyo = warra.getFolio_warra();
                if (warra.getFolio_warra() == 0) 
                {
                    javax.swing.JOptionPane.showMessageDialog(null, "Garantia NO ENCONTRADA");
                    this.txtPatenteAlzamiento.setText("");
                    this.txtDUNAlzamiento.setText("");
                    this.txtNumeroAlzamiento.setText("");
                    this.txtHipoAlzamiento.setText("");
                    limpiar();
                    this.btnGrabarAlzamiento.setVisible(false);
                }
                else
                {
                    String auxiliar = LOGIN.Seguridad.ComprobarAprobacionGarantia("Aprobada", "garantia_warrant", "estado_warra", "folio_warra", apoyo);
                    if (auxiliar.equalsIgnoreCase("Aprobada"))
                    {
                        this.btnGrabarAlzamiento.setVisible(true);
                        txtRutGaraAlzamiento.setText(warra.getRut_garante_warra());
                        txtApellPatGaranteAlzamiento.setText(warra.getApell_paterno_warra());
                        txtApellMaternoAlzamiento.setText(warra.getApell_materno_warra());
                        txtNombreGaranteAlzamiento.setText(warra.getNombre_warra());
                        txtDescripcionAlzamiento.setText(warra.getDescrip_warra());
                        txtOtroComentarioAlzamiento.setText(warra.getComent_warra());
                        this.txtNumeroAlzamiento.setText("");
                        this.txtHipoAlzamiento.setText("");
                        this.txtPatenteAlzamiento.setText("");
                        
                        List<sucursalDTO> listaSucursal = garantiasDAO.listaItemSucursal();
                        for(int i= 0;i< listaSucursal.size();i++){
                        this.cmbSucursalAlzamiento.addItem(listaSucursal.get(i).getNom_sucursal());
                        }
                        this.cmbSucursalAlzamiento.setSelectedItem(warra.getNom_sucursal_warra());
                        txtTipoGarantia.setText("Warrant");
                        Date aux = DTO.ConversionFechas.convertToDate(warra.getFech_ult_tasa_warra());
                        jcUltimaTasacion.setDate(aux);
                        List<monedaDTO> moneda = garantiasDAO.listaItemMoneda();
                        for(int i= 0;i< moneda.size();i++){
                        this.cmbMonedaAlzamiento.addItem(moneda.get(i).getNom_moneda());
                        }
                        this.cmbMonedaAlzamiento.setSelectedItem(warra.getNom_moneda_warra());
                        
                        jcFechaExtincion.setDate(new Date(warra.getFech_exti_warra().getTime()));

//                       

                         if(warra.getMotivo_alza() == null)
                        {
                            lblMensaje.setVisible(false);
                            jLabel7.setVisible(true);
                            txtMotivoAlzamiento.setVisible(true);
                            lblMotivoDeAlza.setVisible(false);
                            btnGrabarAlzamiento.setVisible(true);
                            javax.swing.JOptionPane.showMessageDialog(null, "Hay una solicitud de alzamiento pendiente");
                        }
                        
                        else if (warra.getEstado_alza() != null ) {
                            lblMensaje.setVisible(true);
                            jLabel7.setVisible(false);
                            txtMotivoAlzamiento.setVisible(false);
                            lblMotivoDeAlza.setVisible(true);
                            lblMotivoDeAlza.setText("MOTIVO: " + warra.getMotivo_alza().toUpperCase() + ".");
                            btnGrabarAlzamiento.setVisible(false);
                            javax.swing.JOptionPane.showMessageDialog(null, "solicitud de aprobacion alzamiento hecho");
//                            
                        }
                        else
                        {
                            lblMensaje.setVisible(true);
                            jLabel7.setVisible(false);
                            txtMotivoAlzamiento.setVisible(false);
                            lblMotivoDeAlza.setVisible(true);
                            lblMotivoDeAlza.setText("MOTIVO: " + warra.getMotivo_alza().toUpperCase() + ".");
                            btnGrabarAlzamiento.setVisible(false);
                            javax.swing.JOptionPane.showMessageDialog(null, "Pasar a solicitud en estado de aprobacion alzamiento");
                        }
                        
                    }
                    else
                    {
                        limpiar();
                        this.txtPatenteAlzamiento.setText("");
                        this.txtDUNAlzamiento.setText("");
                        this.txtNumeroAlzamiento.setText("");
                        this.txtHipoAlzamiento.setText("");
                        javax.swing.JOptionPane.showMessageDialog(null, "Esta garantia no se ha aprobado o estado activa. \n Revisa el estado de APROBACION");
                        this.btnGrabarAlzamiento.setVisible(false);
                    }
                }
                
            }
        }
        }catch(Exception e)
        {
            e.getMessage();
        }
        
        //CARGAR GARANTIA CDP
        try
        {
        if (chkCDPAlzamiento.isSelected()) 
        {
            if (!this.txtNumeroAlzamiento.getText().matches("[ 0-9]*")) // expresiones regulares para validar
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese solo números");
                    this.txtPatenteAlzamiento.setText("");
                    this.txtDUNAlzamiento.setText("");
                    this.txtNumeroAlzamiento.setText("");
                    this.txtHipoAlzamiento.setText("");
                    limpiar();
                    this.btnGrabarAlzamiento.setVisible(false);
        }
       else{
            if (txtNumeroAlzamiento.getText().equals("")) 
            {
                javax.swing.JOptionPane.showMessageDialog(null, "Ingrese NUMERO CDP");
                    this.txtPatenteAlzamiento.setText("");
                    this.txtDUNAlzamiento.setText("");
                    this.txtNumeroAlzamiento.setText("");
                    this.txtHipoAlzamiento.setText("");
                    limpiar();
                    this.btnGrabarAlzamiento.setVisible(false);
            }
            else
            {
                cdp = reg.buscarPorNum(Integer.parseInt(txtNumeroAlzamiento.getText()));
                int apoyo = cdp.getFolio_cdp();
                if (cdp.getFolio_cdp() == 0) 
                {
                    javax.swing.JOptionPane.showMessageDialog(null, "Garantia NO ENCONTRADA");
                    this.txtPatenteAlzamiento.setText("");
                    this.txtDUNAlzamiento.setText("");
                    this.txtNumeroAlzamiento.setText("");
                    this.txtHipoAlzamiento.setText("");
                    limpiar();
                    this.btnGrabarAlzamiento.setVisible(false);
                }
                else
                {
                    String auxiliar = LOGIN.Seguridad.ComprobarAprobacionGarantia("Aprobada", "garantia_cdp", "estado_cdp", "folio_cdp", apoyo);
                    if (auxiliar.equalsIgnoreCase("Aprobada"))
                    {
                        this.btnGrabarAlzamiento.setVisible(true);
                        txtRutGaraAlzamiento.setText(cdp.getRut_gara_cdp());
                        txtApellPatGaranteAlzamiento.setText(cdp.getApell_paterno_cdp());
                        txtApellMaternoAlzamiento.setText(cdp.getApell_materno_cdp());
                        txtNombreGaranteAlzamiento.setText(cdp.getNombre_cdp());
//                        txtFolioGaranteAlzamiento.setText(String.valueOf(cdp.getFolio_cdp()));
                        txtDescripcionAlzamiento.setText(cdp.getDescrip_cdp());
                        txtOtroComentarioAlzamiento.setText(cdp.getComent_cdp());
                        this.txtHipoAlzamiento.setText("");
                        this.txtPatenteAlzamiento.setText("");
                        this.txtDUNAlzamiento.setText("");
                        
                        List<sucursalDTO> listaSucursal = garantiasDAO.listaItemSucursal();
                        for(int i= 0;i< listaSucursal.size();i++){
                        this.cmbSucursalAlzamiento.addItem(listaSucursal.get(i).getNom_sucursal());
                        }
                        this.cmbSucursalAlzamiento.setSelectedItem(cdp.getSucu_cdp());

                        txtTipoGarantia.setText("Cdp");
                        Date aux = DTO.ConversionFechas.convertToDate(cdp.getFech_ult_tasa_cdp());
                        jcUltimaTasacion.setDate(aux);
                        List<monedaDTO> moneda = garantiasDAO.listaItemMoneda();
                        for(int i= 0;i< moneda.size();i++){
                        this.cmbMonedaAlzamiento.addItem(moneda.get(i).getNom_moneda());
                        }
                        this.cmbMonedaAlzamiento.setSelectedItem(cdp.getNom_moneda_cdp());
                        jcFechaExtincion.setDate(cdp.getFech_extin_cdp());

//                        

                         if(cdp.getMotivo_alza() == null)
                        {
                            lblMensaje.setVisible(false);
                            jLabel7.setVisible(true);
                            txtMotivoAlzamiento.setVisible(true);
                            lblMotivoDeAlza.setVisible(false);
                            btnGrabarAlzamiento.setVisible(true);
                            javax.swing.JOptionPane.showMessageDialog(null, "Hay una solicitud de alzamiento pendiente");
                        }
                        
                        else if (cdp.getEstado_alza() != null ) {
                            lblMensaje.setVisible(true);
                            jLabel7.setVisible(false);
                            txtMotivoAlzamiento.setVisible(false);
                            lblMotivoDeAlza.setVisible(true);
                            lblMotivoDeAlza.setText("MOTIVO: " + cdp.getMotivo_alza().toUpperCase() + ".");
                            btnGrabarAlzamiento.setVisible(false);
                            javax.swing.JOptionPane.showMessageDialog(null, "solicitud de aprobacion alzamiento hecho");
//                            
                        }
                        else
                        {
                            lblMensaje.setVisible(true);
                            jLabel7.setVisible(false);
                            txtMotivoAlzamiento.setVisible(false);
                            lblMotivoDeAlza.setVisible(true);
                            lblMotivoDeAlza.setText("MOTIVO: " + cdp.getMotivo_alza().toUpperCase() + ".");
                            btnGrabarAlzamiento.setVisible(false);
                            javax.swing.JOptionPane.showMessageDialog(null, "Pasar a solicitud en estado de aprobacion alzamiento");
                        }
                        
                    }
                    else
                    {
                        this.btnGrabarAlzamiento.setVisible(false);
                        limpiar();
                        this.txtPatenteAlzamiento.setText("");
                        this.txtDUNAlzamiento.setText("");
                        this.txtNumeroAlzamiento.setText("");
                        this.txtHipoAlzamiento.setText("");
                        javax.swing.JOptionPane.showMessageDialog(null, "Esta garantia no se ha aprobado o estado activa. \n Revisa el estado de APROBACION");
                    }
                }
            }
        }}}catch(Exception e)
        {
            e.getMessage();
        }
        
        //CARGAR GARANTIA HIPOTECARIA
        try
        {
        if (chkHipotecariaAlzamiento.isSelected()) 
        {
            if (txtHipoAlzamiento.getText().equals("")) 
            {
                javax.swing.JOptionPane.showMessageDialog(null, "Ingrese ROL SII");
                    this.txtPatenteAlzamiento.setText("");
                    this.txtDUNAlzamiento.setText("");
                    this.txtNumeroAlzamiento.setText("");
                    this.txtHipoAlzamiento.setText("");
                    limpiar();
                    this.btnGrabarAlzamiento.setVisible(false);
            }
            else
            {
                casa = reg.buscarPorRol(txtHipoAlzamiento.getText());
                int apoyo = casa.getFolio_garantia_hipo();
                if (casa.getFolio_garantia_hipo() == 0) 
                {
                    javax.swing.JOptionPane.showMessageDialog(null, "Garantia NO ENCONTRADA");
                    this.txtPatenteAlzamiento.setText("");
                    this.txtDUNAlzamiento.setText("");
                    this.txtNumeroAlzamiento.setText("");
                    this.txtHipoAlzamiento.setText("");
                    limpiar();
                    this.btnGrabarAlzamiento.setVisible(false);
                }
                else
                {
                    String auxiliar = LOGIN.Seguridad.ComprobarAprobacionGarantia("Aprobada", "garantia_hipotecaria", "estado_hipo", "folio_garantia_hipo", apoyo);
                    if (auxiliar.equalsIgnoreCase("Aprobada"))
                    {
                        this.btnGrabarAlzamiento.setVisible(true);
                        txtRutGaraAlzamiento.setText(casa.getRut_gara_hipo());
                        txtApellPatGaranteAlzamiento.setText(casa.getApell_paterno_hipo());
                        txtApellMaternoAlzamiento.setText(casa.getApell_materno_hipo());
                        txtNombreGaranteAlzamiento.setText(casa.getNombre_hipo());
//                        txtFolioGaranteAlzamiento.setText(String.valueOf(casa.getFolio_garantia_hipo()));
                        txtDescripcionAlzamiento.setText(casa.getDescrip_hipo());
                        txtOtroComentarioAlzamiento.setText(casa.getComent_hipo());
                        this.txtPatenteAlzamiento.setText("");
                        this.txtDUNAlzamiento.setText("");
                        this.txtNumeroAlzamiento.setText("");
                        
                        List<sucursalDTO> listaSucursal = garantiasDAO.listaItemSucursal();
                        for(int i= 0;i< listaSucursal.size();i++){
                        this.cmbSucursalAlzamiento.addItem(listaSucursal.get(i).getNom_sucursal());
                        }
                        this.cmbSucursalAlzamiento.setSelectedItem(casa.getSucursal_hipo());
                        txtTipoGarantia.setText("Hipotecaria");
                        Date aux = DTO.ConversionFechas.convertToDate(casa.getFech_ult_tasa_hipo());
                        jcUltimaTasacion.setDate(aux);
                        List<monedaDTO> moneda = garantiasDAO.listaItemMoneda();
                        for(int i= 0;i< moneda.size();i++){
                        this.cmbMonedaAlzamiento.addItem(moneda.get(i).getNom_moneda());
                        }
                        this.cmbMonedaAlzamiento.setSelectedItem(casa.getMoneda_hipo());
                        
                        ///////FECHA VENCIMIENTO==================================
                        jcFechaExtincion.setDate(new Date(casa.getFech_extincion_hipo().getTime()));
                        ////////////////====================================
                      
                        if(casa.getMotivo_alza() == null)
                        {
                            lblMensaje.setVisible(false);
                            jLabel7.setVisible(true);
                            txtMotivoAlzamiento.setVisible(true);
                            lblMotivoDeAlza.setVisible(false);
                            btnGrabarAlzamiento.setVisible(true);
                            javax.swing.JOptionPane.showMessageDialog(null, "Hay una solicitud de alzamiento pendiente");
                        }
                        
                        else if (casa.getEstado_alza() != null ) {
                            lblMensaje.setVisible(true);
                            jLabel7.setVisible(false);
                            txtMotivoAlzamiento.setVisible(false);
                            lblMotivoDeAlza.setVisible(true);
                            lblMotivoDeAlza.setText("MOTIVO: " + casa.getMotivo_alza().toUpperCase() + ".");
                            btnGrabarAlzamiento.setVisible(false);
                            javax.swing.JOptionPane.showMessageDialog(null, "solicitud de aprobacion alzamiento hecho");
                           
                        }
                        else
                        {
                            lblMensaje.setVisible(true);
                            jLabel7.setVisible(false);
                            txtMotivoAlzamiento.setVisible(false);
                            lblMotivoDeAlza.setVisible(true);
                            lblMotivoDeAlza.setText("MOTIVO: " + casa.getMotivo_alza().toUpperCase() + ".");
                            btnGrabarAlzamiento.setVisible(false);
                            javax.swing.JOptionPane.showMessageDialog(null, "Pasar a solicitud en estado de aprobacion alzamiento");
                        }
   
                    }
                    else
                    {
                        this.btnGrabarAlzamiento.setVisible(false);
                        limpiar();
                        this.txtPatenteAlzamiento.setText("");
                        this.txtDUNAlzamiento.setText("");
                        this.txtNumeroAlzamiento.setText("");
                        this.txtHipoAlzamiento.setText("");
                        javax.swing.JOptionPane.showMessageDialog(null, "Esta garantia no se ha aprobado o estado activa. \n Revisa el estado de APROBACION");
                    }
                }
            }
        }
        }catch(Exception e)
        {
            e.getMessage();
        }
    }//GEN-LAST:event_btnBuscarActionPerformed

    private void chkAutomotrizAlzamientoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkAutomotrizAlzamientoActionPerformed
        if (chkAutomotrizAlzamiento.isSelected()) {
            pnlAutomotriz.setVisible(true);
            pnlWarrant.setVisible(false);
            pnlCDP.setVisible(false);
            pnlHipotecaria.setVisible(false);
        }
        else
        {
            pnlAutomotriz.setVisible(false);
        }
    }//GEN-LAST:event_chkAutomotrizAlzamientoActionPerformed

    private void chkWarrantAlzamientoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkWarrantAlzamientoActionPerformed
         if (chkWarrantAlzamiento.isSelected()) {
            pnlWarrant.setVisible(true);
            pnlCDP.setVisible(false);
            pnlHipotecaria.setVisible(false);
            pnlAutomotriz.setVisible(false);
        }
        else
        {
            pnlWarrant.setVisible(false);
        }
    }//GEN-LAST:event_chkWarrantAlzamientoActionPerformed

    private void chkCDPAlzamientoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkCDPAlzamientoActionPerformed
        if (chkCDPAlzamiento.isSelected()) {
            pnlCDP.setVisible(true);
            pnlHipotecaria.setVisible(false);
            pnlAutomotriz.setVisible(false);
            pnlWarrant.setVisible(false);
        }
        else
        {
            pnlCDP.setVisible(false);
        }
    }//GEN-LAST:event_chkCDPAlzamientoActionPerformed

    private void chkHipotecariaAlzamientoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkHipotecariaAlzamientoActionPerformed
        if (chkHipotecariaAlzamiento.isSelected()) {
            pnlHipotecaria.setVisible(true);
            pnlAutomotriz.setVisible(false);
            pnlWarrant.setVisible(false);
            pnlCDP.setVisible(false);
        }
        else
        {
            pnlHipotecaria.setVisible(false);
        }
    }//GEN-LAST:event_chkHipotecariaAlzamientoActionPerformed

    private void btnGrabarAlzamientoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGrabarAlzamientoActionPerformed
        String tipo = txtTipoGarantia.getText();
        if (tipo.equalsIgnoreCase("Automotriz")) 
        {
            auto.setFech_extincion_auto(new Date(jcFechaExtincion.getDate().getTime()));
            auto.setFecha_ult_tasa_auto(new SimpleDateFormat("dd/MM/yyyy").format(jcUltimaTasacion.getDate()));
            auto.setMotivo_alza(txtMotivoAlzamiento.getText());
            int respuesta = javax.swing.JOptionPane.showConfirmDialog(null, "Se Realizara el alzamiento de la garantia tipo: " + tipo.toUpperCase() + ".", "Alzamiento", JOptionPane.OK_CANCEL_OPTION);
            if (respuesta == 0) 
            {
                reg.alzamientoGarantiaAutomotriz(auto, user);
                javax.swing.JOptionPane.showMessageDialog(this, "Solicitud de Alzamiento realizada.");
                MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
                venMenuPrincipal.setVisible(true);
                AlzamientoGarantia.this.dispose();
            }
            else
            {
                
            }
        }
        if (tipo.equalsIgnoreCase("Warrant")) 
        {
            
            warra.setFech_exti_warra(new Date(jcFechaExtincion.getDate().getTime()));
            warra.setFech_ult_tasa_warra(new SimpleDateFormat("dd/MM/yyyy").format(jcUltimaTasacion.getDate()));
            warra.setMotivo_alza(txtMotivoAlzamiento.getText());
            int respuesta = javax.swing.JOptionPane.showConfirmDialog(null, "Se Realizara el alzamiento de la garantia tipo: " + tipo.toUpperCase() + ".", "Alzamiento", JOptionPane.OK_CANCEL_OPTION);
            if (respuesta == 0) 
            {
                reg.alzamientoGarantiaWarrant(warra, user);
                javax.swing.JOptionPane.showMessageDialog(this, "Solicitud de Alzamiento realizada.");
                MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
                venMenuPrincipal.setVisible(true);
                AlzamientoGarantia.this.dispose();
            }
            else
            {
                
            }
        }
        
        if (tipo.equalsIgnoreCase("Cdp")) 
        {
            cdp.setFech_extin_cdp(new Date(jcFechaExtincion.getDate().getTime()));
            cdp.setFech_ult_tasa_cdp(new SimpleDateFormat("dd/MM/yyyy").format(jcUltimaTasacion.getDate()));
            cdp.setMotivo_alza(txtMotivoAlzamiento.getText());
            int respuesta = javax.swing.JOptionPane.showConfirmDialog(null, "Se Realizara el alzamiento de la garantia tipo: " + tipo.toUpperCase() + ".", "Alzamiento", JOptionPane.OK_CANCEL_OPTION);
            if (respuesta == 0) 
            {
                reg.alzamientoGarantiaCDP(cdp, user);
                javax.swing.JOptionPane.showMessageDialog(this, "Solicitud de Alzamiento realizada.");
                MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
                venMenuPrincipal.setVisible(true);
                AlzamientoGarantia.this.dispose();
            }
            else
            {
                
            }
        }
        
        if (tipo.equalsIgnoreCase("Hipotecaria")) 
        {
            //////////////FECHA VENCE=================

            casa.setFech_extincion_hipo(new Date(jcFechaExtincion.getDate().getTime()));
            ///////////=========================================
            
            casa.setFech_ult_tasa_hipo(new SimpleDateFormat("dd/MM/yyyy").format(jcUltimaTasacion.getDate()));
            casa.setMotivo_alza(txtMotivoAlzamiento.getText());
            int respuesta = javax.swing.JOptionPane.showConfirmDialog(null, "Se Realizara el alzamiento de la garantia tipo: " + tipo.toUpperCase() + ".", "Alzamiento", JOptionPane.OK_CANCEL_OPTION);
            if (respuesta == 0) 
            {
                reg.alzamientoGarantiaHipotecaria(casa, user);
                javax.swing.JOptionPane.showMessageDialog(this, "Solicitud de Alzamiento realizada.");
                MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
                venMenuPrincipal.setVisible(true);
                AlzamientoGarantia.this.dispose();
            }
            else
            {
                
            }
        }
    }//GEN-LAST:event_btnGrabarAlzamientoActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
        venMenuPrincipal.setVisible(true);
        AlzamientoGarantia.this.dispose();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void btnMenuPrincipalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMenuPrincipalActionPerformed
       MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
        venMenuPrincipal.setVisible(true);
        AlzamientoGarantia.this.dispose();
    }//GEN-LAST:event_btnMenuPrincipalActionPerformed

    private void btnBuscarIDGarantiaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarIDGarantiaActionPerformed
      String fechaImpresion = String.valueOf(Fechas.FechaSistema());
        if(this.rbtRolSii.isSelected())
       {
           try
        {
            DefaultTableModel modelo1 =(DefaultTableModel)this.tbSalidaIDImprimir.getModel();      
             modelo1.setNumRows(0);
            ArrayList<garantiaHipotecariaDTO> salida = reg.ListarPorRolHipo(this.txtBuscarIDGarantia.getText().trim());
            if(salida.isEmpty())
            {
                 
                 this.txtBuscarIDGarantia.setText(null);
                DefaultTableModel modelo =(DefaultTableModel)this.tbSalidaIDImprimir.getModel();      
                modelo.setNumRows(0);
                javax.swing.JOptionPane.showMessageDialog(this, "No hay garantias registradas!");
               
            }else
            {
            DefaultTableModel modelo =(DefaultTableModel)this.tbSalidaIDImprimir.getModel(); 
          
            modelo.setColumnCount(0);
                if(modelo.getColumnCount() < 1)
                {
                    
                    Object[] arr1 ={"Rut: ","Nombre: ","Calle: ", "Garantía: ", "Número identificatorio Hipotecario: ",
                        "Número de folio: ", "Monto incial: ", "Creación de la garantía: ", "Sucursal:  ",
                        "Cobertura: ","Superficie: ","Dirección (Crédito): ", "Registro CBR: ","Unidad Superficie: ",
                        "Fecha último débito: ","Moneda: ","Tipo construcción: ","Comuna: ","Estado contribución: ",
                        "Localidad Registro: ","Fecha última tasación: ","Tipo garantía: ","Grado preferencía: ",
                        "Metros. construidos: ","Años repertorios: ","A. Fojas: ","Fecha vencimiento: ","Fecha último Revaluo: ",
                        "Fecha último crédito: ","Estado de la garantía: ","Fecha Aprobado/Rechazado: ","Fecha de modificación: ",
                        "Fecha ingreso alzamiento: ",
                        
                        "Usuario: "  };
                    modelo.addColumn("Concepto", arr1);
                    
                    for(garantiaHipotecariaDTO x: salida)
                {
                    Object[] arr2 ={
                        x.getRut_gara_hipo(),
                        x.getNombre_hipo()  + "  " + x.getApell_materno_hipo() + "  " + x.getApell_materno_hipo(),
                        x.getCalle_hipo()+"  "+ x.getNum_dire_hipo() ,x.getNombre_garantia_hipo(),x.getRol_sii_hipo(),x.getFolio_garantia_hipo(),
                        x.getMonto_inicial(),x.getFech_crea_hipo(),x.getSucursal_hipo(),x.getCobertura_hipo(),x.getSuperficie_hipo(),
                        x.getDireccion_hipo()+"  "+x.getNum_hipo(),x.getRegistro_cbr_hipo(),x.getUni_superficie_hipo(),x.getFech_ult_debito_hipo(),
                        x.getMoneda_hipo(),x.getTipo_construccion_hipo(),x.getComuna_hipo(),x.getEstado_constrib_hipo(),
                        x.getLocalidad_reg_hipo(),x.getFech_ult_tasa_hipo(),x.getTipo_garantia_hipo(),x.getGrado_prefere_hipo(),
                        x.getMts_construidos_hipo(),x.getAnos_repertorio_hipo(),x.getA_fojas_hipo(),x.getFech_extincion_hipo(),x.getFech_ult_revaluo_hipo(),
                        x.getFech_ult_credito_hipo(),x.getEstado_hipo(),x.getFech_crea_hipo(),x.getFech_modifi_hipo(),fechaImpresion,
                        x.getNombre_usuario()

                    };
                     
                    modelo.addColumn("Contenido",arr2);    
                }
                    
                    Object[] arr3 = {" "," "," "," "," "," "," "," "," "," "," "
                                    ," "," "," "," "," "," "," "," "," "," "
                                    ," "," "," "," "," "," "," "," "," "," "," "," "," "};
                    modelo.addColumn("Observaciones",arr3);
                    
                }
            }
        }catch(Exception e)
        {
            e.getMessage();
        }
       }
       else if(this.rbtPatente.isSelected())
       {
            try
         {
            DefaultTableModel modelo2 =(DefaultTableModel)this.tbSalidaIDImprimir.getModel();      
             modelo2.setNumRows(0);
             ArrayList<garantiaAutomotrizDTO> salida = reg.ListarPorPatenteAuto(this.txtBuscarIDGarantia.getText().trim());
             if(salida.isEmpty())
             {
                
                 this.txtBuscarIDGarantia.setText(null);
                 DefaultTableModel model = (DefaultTableModel)this.tbSalidaIDImprimir.getModel();
                 model.setNumRows(0);
                 javax.swing.JOptionPane.showMessageDialog(this, "No hay garantias registradas!");
             }else
             {
                 
                 DefaultTableModel model = (DefaultTableModel)this.tbSalidaIDImprimir.getModel();
                 model.setColumnCount(0);
                 
                 if(model.getColumnCount() < 1)
                {
                    
                    Object[] arr1 ={"Rut: ","Nombre: ", "Calle: ", "Garantía: ", "Número identificatorio Automotriz: ",
                        "Número de folio: ", "Monto incial: ", "Creación de la garantía: ", "Sucursal:  ",
                        "Dirección (Crédito): ","Marca: ","Número de Chasis: ","Fecha ultimo debito",
                        "Moneda: ","Año: ","Número de Motor: ","Fecha última Tasación: ","Tipo garantía: ",
                        "Modelo: ","Número Regsitro de Prenda: ","Fecha vencimiento: ","Fecha último revaluo: ",
                        "Fecha último crédito: ","Estado de la garantía: ","Fecha Aprobado/Rechazo: ","Fecha de modificación: ",
                        "Fecha ingreso alzamiento: ",
                        "Usuario: " };
                    model.addColumn("Concepto", arr1);
                    
                    for(garantiaAutomotrizDTO a: salida)
                {
                    Object[] arr2 ={
                         a.getRut_gara_auto(),
                         a.getNombre_auto() + "  " + a.getApell_paterno_auto() + "  " + a.getApell_materno_auto(),
                         a.getCalle_auto() + "  " + a.getNum_auto() ,
                         a.getNombre_garantia_auto(),
                         a.getPatente_auto(),
                         a.getFolio_garantia_auto(),
                         a.getMonto_inicial(),
                         a.getFech_crea_auto(),
                         a.getSucursal_auto(),
                         a.getDireccion_auto(),a.getMarca_auto(),a.getNum_chasis_auto(),a.getFech_ult_debito_auto(),
                         a.getMoneda_auto(),a.getAño_auto(),a.getNum_motor_auto(),a.getFecha_ult_tasa_auto(),
                         a.getTipo_garantia_auto(),a.getModelo_auto(),a.getNum_reg_prenda_auto(),a.getFech_extincion_auto(),
                         a.getFech_ult_reval_auto(),a.getFech_ult_reval_credito_auto(),
                         a.getEstado_auto(),
                         a.getFech_crea_auto(),
                         a.getFecha_modifi_auto(),
                         fechaImpresion,
                         a.getNombre_usuario()
                    };
                     
                    model.addColumn("Contenido",arr2);    
                }
                    
                    Object[] arr3 = {" "," "," "," "," "," "," "," "," "," ",
                                     " "," "," "," "," "," "," "," "," "," ",
                                     " "," "," "," "," "," "," "," "};
                    model.addColumn("Observaciones",arr3);
                    
                }

             }
       }catch(Exception e)
       {
           e.getMessage();
       }
       }
       else if(this.rbtDun.isSelected())
       {
         try{
             DefaultTableModel modelo3 =(DefaultTableModel)this.tbSalidaIDImprimir.getModel();      
             modelo3.setNumRows(0);
            ArrayList<garantiaWarrantsDTO> salida = reg.ListarPorDunWarra(this.txtBuscarIDGarantia.getText().trim());
            if(salida.isEmpty())
            {
                
                this.txtBuscarIDGarantia.setText(null);
                DefaultTableModel model = (DefaultTableModel)tbSalidaIDImprimir.getModel();
                model.setNumRows(0);
                javax.swing.JOptionPane.showMessageDialog(this, "No hay garantias registradas!");
            }
            else
            {
                
                DefaultTableModel model = (DefaultTableModel)tbSalidaIDImprimir.getModel();
                model.setColumnCount(0);
                
                if(model.getColumnCount() < 1)
                {
                   
                    Object[] arr1 ={"Rut: ","Nombre: ", "Calle: ", "Garantía: ", "Número identificatorio Warrant: ",
                        "Número de folio: ", "Monto incial: ", "Creación de la garantía: ", "Sucursal: ",
                        "Tipo producto: ","Fecha último debito: ", "Moneda: ","Fecha última Tasación: ",
                        "Tipo garantía: ","Ingreso de Producto: ","Fecha vencimiento: ","Fecha último revaluo: ",
                        "Fecha último crédito: ","Estado de la garantía: ","Fecha Aprobado/Rechazado: ","Fecha de modificación: ",
                        "Fecha ingreso alzamiento: ",
                        "Usuario: " };
                    model.addColumn("Concepto", arr1);
                    
                    for(garantiaWarrantsDTO w: salida)
                {
                    Object[] arr2 ={
                    w.getRut_garante_warra(),
                    w.getNombre_warra() + "  " + w.getApell_paterno_warra() + "  " + w.getApell_materno_warra(),
                    w.getCalle_warra() + "  " + w.getNum_warra(),
                    w.getNom_garantia_warra(),
                    w.getDun_warra(),w.getFolio_warra(),w.getMonto_inicial(),w.getFech_crea_warra(),
                    w.getNom_sucursal_warra(),w.getTipo_prod_warra(),w.getFech_ult_deb_warra(),
                    w.getNom_moneda_warra(),w.getFech_ult_tasa_warra(),w.getTipo_gara_warra(),w.getIngre_prod_warra(),
                    w.getFech_exti_warra(),w.getFech_ult_reval_warra(),w.getFech_ult_cred_warra(),
                    w.getEstado_warra(),w.getFech_crea_warra(),w.getFech_modifi_warra(),
                    fechaImpresion,
                    w.getNombre_usuario()
                    };
                     
                    model.addColumn("Contenido",arr2);    
                }
                    
                    Object[] arr3 = {" "," "," "," "," "," "," "," "," "," ",
                                     " "," "," "," "," "," "," "," "," "," "," "," "," "};
                    model.addColumn("Observaciones",arr3);
                    
                }
                
               
            }
        }
        catch(Exception e)
        {
            e.getMessage();
        }    
       }
       else if(this.rbtNumeroCDP.isSelected())
       {
            try
       {
           
             DefaultTableModel modelo4 =(DefaultTableModel)this.tbSalidaIDImprimir.getModel();      
             modelo4.setNumRows(0);
           ArrayList<garantiaCdpOtrosDTO> salida = reg.ListarPorCdp(Integer.parseInt(this.txtBuscarIDGarantia.getText().trim()));
           if(salida.isEmpty())
           {
               
               this.txtBuscarIDGarantia.setText(null);
               DefaultTableModel modelo = (DefaultTableModel)this.tbSalidaIDImprimir.getModel();
               modelo.setNumRows(0);
               javax.swing.JOptionPane.showMessageDialog(this, "No hay garantias registradas!");
           }
           else
           {
               
               DefaultTableModel modelo = (DefaultTableModel)this.tbSalidaIDImprimir.getModel();
               modelo.setColumnCount(0);
               
               if(modelo.getColumnCount() < 1)
                {
                    
                    Object[] arr1 ={"Rut: ","Nombre: ", "Calle: ", "Garantía: ", "Número identificatorio CDP: ",
                        "Número de folio: ", "Monto incial: ", "Creación de la garantía: ", "Sucursal: ",
                        "Fecha último debito: ","Moneda: ","Fecha última tasación","Tipo garantía: ","Fecha vencimiento: ",
                        "Fecha último revaluo: ","Fecha último credito: ","Estado de la garantía: ","Fecha aprobado/Rechazado: ",
                        "Fecha de modificación: ",
                        "Fecha ingreso alzamiento: ",
                        "Usuario: " };
                    modelo.addColumn("Concepto", arr1);
                    
                    for(garantiaCdpOtrosDTO c: salida)
                {
                    Object[] arr2 ={
                                   c.getRut_gara_cdp(),
                                   c.getNombre_cdp() + "  " + c.getApell_paterno_cdp() + "  " + c.getApell_materno_cdp(),
                                   c.getCalle_cdp() + "  " + c.getNumero_calle_cdp(),
                                   c.getNom_garantia_cdp(),
                                   c.getNum_cdp(),
                                   c.getFolio_cdp(),
                                   c.getMonto_inicial(),
                                   c.getFech_crea_cdp(),
                                   c.getSucu_cdp(),
                                   c.getFech_ult_deb_cdp(),
                                   c.getNom_moneda_cdp(),
                                   c.getFech_ult_tasa_cdp(),
                                   c.getTipo_garantia_cdp(),
                                   c.getFech_extin_cdp(),
                                   c.getFech_ult_reval_cdp(),
                                   c.getFech_ult_cred_cdp(),
                                   c.getEstado_cdp(),
                                   c.getFech_crea_cdp(),
                                   c.getFech_modif_cdp(),
                                   fechaImpresion,
                                   c.getNombre_usuario()
                    };
                     
                    modelo.addColumn("Contenido",arr2);    
                }
                    
                    Object[] arr3 = {" "," "," "," "," "," "," "," "," "," ",
                                     " "," "," "," "," "," "," "," "," "," "," "};
                    modelo.addColumn("Observaciones",arr3);
                    
                }
    
           }
       }
       catch(Exception e)
       {
           e.getMessage();
       }
       }
    }//GEN-LAST:event_btnBuscarIDGarantiaActionPerformed

    private void btnImprimirGarantiaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImprimirGarantiaActionPerformed
        if(this.rbtRolSii.isSelected())
        {
        try {
            
        int fila= 0;
  
        List Resultados = new ArrayList();
        ComprobanteGeneralDTO tipo;
        Resultados.clear();
        
        for(fila = 0; fila< tbSalidaIDImprimir.getRowCount(); fila++)
        {
            
           tipo = new ComprobanteGeneralDTO(String.valueOf(tbSalidaIDImprimir.getValueAt(fila, 0)),
                    " " + String.valueOf(tbSalidaIDImprimir.getValueAt(fila, 1)), " " + String.valueOf(tbSalidaIDImprimir.getValueAt(fila, 2))  + "\n");
           Resultados.add(tipo);

        }
        
            String reportSource = "C:\\Users\\SoftGroup\\Documents\\NetBeansProjects\\trunk\\AppGarantias\\build\\classes\\Reporte\\ComprobanteGeneralGarantias.jrxml";

            JasperReport jr = JasperCompileManager.compileReport(reportSource);
            
            
            JFrame reporte = new JFrame();
            reporte.setSize(900, 700);
            reporte.setLocationRelativeTo(null);
            reporte.setTitle("IMPRESIÓN");
            String fechaImpresion = String.valueOf(Fechas.FechaSistema());
            
            Map<String, Object> map = new HashMap<String, Object>();
            
            map.put("Titulo", "Sistema Gestión de Garantías Bancarias");
            map.put("fecha", fechaImpresion);
            map.put("nombreBanco", "Banco xxxxxx");
            map.put("subtitulo", "Comprobante Ingreso Alzamiento Hipotecaria");
            map.put("timbre", "Timbre");
            map.put("fechaUsuario","Fecha");
            map.put("firma","Firma");
            
            
            JRBeanCollectionDataSource coleccion = new JRBeanCollectionDataSource(Resultados);
            JasperPrint jp = JasperFillManager.fillReport(jr, map, coleccion);
            JRViewer jv = new JRViewer(jp);
            reporte.getContentPane().add(jv);
            reporte.setVisible(true);
            
            
            
        } catch (JRException e) {
            e.printStackTrace();
            Logger.getLogger(AlzamientoGarantia.class.getName()).log(Level.SEVERE, null, e);
        }
        }
        else if(this.rbtPatente.isSelected())
        {
        try {
            
        int fila= 0;
  
        List Resultados = new ArrayList();
        ComprobanteGeneralDTO tipo;
        Resultados.clear();
        
        for(fila = 0; fila< tbSalidaIDImprimir.getRowCount(); fila++)
        {
            
           tipo = new ComprobanteGeneralDTO(String.valueOf(tbSalidaIDImprimir.getValueAt(fila, 0)),
                    " " + String.valueOf(tbSalidaIDImprimir.getValueAt(fila, 1)), " " + String.valueOf(tbSalidaIDImprimir.getValueAt(fila, 2))  + "\n");
           Resultados.add(tipo);

        }
        
            String reportSource = "C:\\Users\\SoftGroup\\Documents\\NetBeansProjects\\trunk\\AppGarantias\\build\\classes\\Reporte\\ComprobanteGeneralGarantias.jrxml";

            JasperReport jr = JasperCompileManager.compileReport(reportSource);
            
            
            JFrame reporte = new JFrame();
            reporte.setSize(900, 700);
            reporte.setLocationRelativeTo(null);
            reporte.setTitle("IMPRESIÓN");
            String fechaImpresion = String.valueOf(Fechas.FechaSistema());
            
            Map<String, Object> map = new HashMap<String, Object>();
            
            map.put("Titulo", "Sistema Gestión de Garantías Bancarias");
            map.put("fecha", fechaImpresion);
            map.put("nombreBanco", "Banco xxxxxx");
            map.put("subtitulo", "Comprobante Ingreso Alzamiento Automotriz");
            map.put("timbre", "Timbre");
            map.put("fechaUsuario","Fecha");
            map.put("firma","Firma");
            
            
            JRBeanCollectionDataSource coleccion = new JRBeanCollectionDataSource(Resultados);
            JasperPrint jp = JasperFillManager.fillReport(jr, map, coleccion);
            JRViewer jv = new JRViewer(jp);
            reporte.getContentPane().add(jv);
            reporte.setVisible(true);
            
            
            
        } catch (JRException e) {
            e.printStackTrace();
            Logger.getLogger(AlzamientoGarantia.class.getName()).log(Level.SEVERE, null, e);
        }
        }
        else if(this.rbtDun.isSelected())
        {
             try {
            
        int fila= 0;
  
        List Resultados = new ArrayList();
        ComprobanteGeneralDTO tipo;
        Resultados.clear();
        
        for(fila = 0; fila< tbSalidaIDImprimir.getRowCount(); fila++)
        {
            
           tipo = new ComprobanteGeneralDTO(String.valueOf(tbSalidaIDImprimir.getValueAt(fila, 0)),
                    " " + String.valueOf(tbSalidaIDImprimir.getValueAt(fila, 1)), " " + String.valueOf(tbSalidaIDImprimir.getValueAt(fila, 2))  + "\n");
           Resultados.add(tipo);

        }
        
            String reportSource = "C:\\Users\\SoftGroup\\Documents\\NetBeansProjects\\trunk\\AppGarantias\\build\\classes\\Reporte\\ComprobanteGeneralGarantias.jrxml";

            JasperReport jr = JasperCompileManager.compileReport(reportSource);
            
            
            JFrame reporte = new JFrame();
            reporte.setSize(900, 700);
            reporte.setLocationRelativeTo(null);
            reporte.setTitle("IMPRESIÓN");
            String fechaImpresion = String.valueOf(Fechas.FechaSistema());
            
            Map<String, Object> map = new HashMap<String, Object>();
            
            map.put("Titulo", "Sistema Gestión de Garantías Bancarias");
            map.put("fecha", fechaImpresion);
            map.put("nombreBanco", "Banco xxxxxx");
            map.put("subtitulo", "Comprobante Imgreso Alzamiento Warrant");
            map.put("timbre", "Timbre");
            map.put("fechaUsuario","Fecha");
            map.put("firma","Firma");
            
            
            JRBeanCollectionDataSource coleccion = new JRBeanCollectionDataSource(Resultados);
            JasperPrint jp = JasperFillManager.fillReport(jr, map, coleccion);
            JRViewer jv = new JRViewer(jp);
            reporte.getContentPane().add(jv);
            reporte.setVisible(true);
            
            
            
        } catch (JRException e) {
            e.printStackTrace();
            Logger.getLogger(AlzamientoGarantia.class.getName()).log(Level.SEVERE, null, e);
        }
        }
        else if (this.rbtNumeroCDP.isSelected())
        {
             try {
            
        int fila= 0;
  
        List Resultados = new ArrayList();
        ComprobanteGeneralDTO tipo;
        Resultados.clear();
        
        for(fila = 0; fila< tbSalidaIDImprimir.getRowCount(); fila++)
        {
            
           tipo = new ComprobanteGeneralDTO(String.valueOf(tbSalidaIDImprimir.getValueAt(fila, 0)),
                    " " + String.valueOf(tbSalidaIDImprimir.getValueAt(fila, 1)), " " + String.valueOf(tbSalidaIDImprimir.getValueAt(fila, 2))  + "\n");
           Resultados.add(tipo);

        }
        
            String reportSource = "C:\\Users\\SoftGroup\\Documents\\NetBeansProjects\\trunk\\AppGarantias\\build\\classes\\Reporte\\ComprobanteGeneralGarantias.jrxml";

            JasperReport jr = JasperCompileManager.compileReport(reportSource);
            
            
            JFrame reporte = new JFrame();
            reporte.setSize(900, 700);
            reporte.setLocationRelativeTo(null);
            reporte.setTitle("IMPRESIÓN");
            String fechaImpresion = String.valueOf(Fechas.FechaSistema());
            
            Map<String, Object> map = new HashMap<String, Object>();
            
            map.put("Titulo", "Sistema Gestión de Garantías Bancarias");
            map.put("fecha", fechaImpresion);
            map.put("nombreBanco", "Banco xxxxxx");
            map.put("subtitulo", "Comprobante Ingreso Alzamiento CDP");
            map.put("timbre", "Timbre");
            map.put("fechaUsuario","Fecha");
            map.put("firma","Firma");
            
            
            JRBeanCollectionDataSource coleccion = new JRBeanCollectionDataSource(Resultados);
            JasperPrint jp = JasperFillManager.fillReport(jr, map, coleccion);
            JRViewer jv = new JRViewer(jp);
            reporte.getContentPane().add(jv);
            reporte.setVisible(true);
            
            
            
        } catch (JRException e) {
            e.printStackTrace();
            Logger.getLogger(AlzamientoGarantia.class.getName()).log(Level.SEVERE, null, e);
        }
        }
    }//GEN-LAST:event_btnImprimirGarantiaActionPerformed

    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        /*
//         * Set the Nimbus look and feel
//         */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /*
//         * If Nimbus (introduced in Java SE 6) is not available, stay with the
//         * default look and feel. For details see
//         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(AlzamientoGarantia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(AlzamientoGarantia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(AlzamientoGarantia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(AlzamientoGarantia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /*
//         * Create and display the form
//         */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//
//            public void run() {
//                new AlzamientoGarantia().setVisible(true);
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBuscar;
    private javax.swing.JButton btnBuscarIDGarantia;
    private javax.swing.JButton btnGrabarAlzamiento;
    private javax.swing.JButton btnImprimirGarantia;
    private javax.swing.JButton btnMenuPrincipal;
    private javax.swing.JButton btnMenuPrincipalAlzamiento;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JCheckBox chkAutomotrizAlzamiento;
    private javax.swing.JCheckBox chkCDPAlzamiento;
    private javax.swing.JCheckBox chkHipotecariaAlzamiento;
    private javax.swing.JCheckBox chkWarrantAlzamiento;
    private javax.swing.JComboBox cmbMonedaAlzamiento;
    private javax.swing.JComboBox cmbSucursalAlzamiento;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTabbedPane jTabbedPane1;
    private com.toedter.calendar.JDateChooser jcFechaExtincion;
    private com.toedter.calendar.JDateChooser jcUltimaTasacion;
    private javax.swing.JLabel lblDescripcion;
    private javax.swing.JLabel lblIngresoGaraAuto;
    private javax.swing.JLabel lblLogo;
    private javax.swing.JLabel lblMensaje;
    private javax.swing.JLabel lblMotivoDeAlza;
    private javax.swing.JPanel pnlAutomotriz;
    private javax.swing.JPanel pnlCDP;
    private javax.swing.JPanel pnlDatosPersoGara1;
    private javax.swing.JPanel pnlDescripGarantia;
    private javax.swing.JPanel pnlHipotecaria;
    private javax.swing.JPanel pnlWarrant;
    private javax.swing.JRadioButton rbtDun;
    private javax.swing.JRadioButton rbtNumeroCDP;
    private javax.swing.JRadioButton rbtPatente;
    private javax.swing.JRadioButton rbtRolSii;
    private javax.swing.JTable tbSalidaIDImprimir;
    private javax.swing.JTextField txtApellMaternoAlzamiento;
    private javax.swing.JTextField txtApellPatGaranteAlzamiento;
    private javax.swing.JTextField txtBuscarIDGarantia;
    private javax.swing.JTextField txtDUNAlzamiento;
    private javax.swing.JTextArea txtDescripcionAlzamiento;
    private javax.swing.JTextField txtHipoAlzamiento;
    private javax.swing.JTextField txtMotivoAlzamiento;
    private javax.swing.JTextField txtNombreGaranteAlzamiento;
    private javax.swing.JTextField txtNumeroAlzamiento;
    private javax.swing.JTextArea txtOtroComentarioAlzamiento;
    private javax.swing.JTextField txtPatenteAlzamiento;
    private javax.swing.JTextField txtRutGaraAlzamiento;
    private javax.swing.JTextField txtTipoGarantia;
    // End of variables declaration//GEN-END:variables

    private void limpiar() {
        txtRutGaraAlzamiento.setText(null);
        txtApellPatGaranteAlzamiento.setText(null);
        txtApellMaternoAlzamiento.setText(null);
        txtNombreGaranteAlzamiento.setText(null);
//        txtFolioGaranteAlzamiento.setText(null);
        txtDescripcionAlzamiento.setText(null);
        txtOtroComentarioAlzamiento.setText(null);
        this.cmbSucursalAlzamiento.setSelectedItem("Seleccione");
        this.txtTipoGarantia.setText(null);
        this.jcUltimaTasacion.setCalendar(null);
        this.cmbMonedaAlzamiento.setSelectedItem("Seleccione");
        this.jcFechaExtincion.setCalendar(null);
        lblMensaje.setVisible(false);
        lblMotivoDeAlza.setVisible(false);
    }
}
